// 专家找工长页
//  MZY_EX_foremanViewController.m
//  FullHouse
//
//  Created by dllo on 16/1/28.
//  Copyright © 2016年 yy. All rights reserved.
//

#import "MZY_EX_foremanViewController.h"
#import "NetworkingTool.h"
#import "UIImageView+WebCache.h"
#import "MBProgressHUD.h"
#import "MZY_designerMaterial.h"
#import "MZY_EX_informationCell.h"
#import "MZY_EX_evaliuationCell.h"

#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
#define HORIZONTAL [UIScreen mainScreen].bounds.size.width / 414
#define VERTICAL [UIScreen mainScreen].bounds.size.height / 736

@interface MZY_EX_foremanViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic, retain)UIView *headView;
@property(nonatomic, retain)UIImageView *faceImageView;
@property(nonatomic, retain)UILabel *nameLabel;
@property(nonatomic, retain)UILabel *jobLabel;
@property(nonatomic, retain)UILabel *workCountLabel;
@property(nonatomic, retain)UILabel *workLabel;
@property(nonatomic, retain)UITextField *textField;
@property(nonatomic, retain)UILabel *appointmentCountLabel;
@property(nonatomic, retain)UILabel *appointmentLabel;
@property(nonatomic, retain)NSMutableArray *introduceArr;
@property(nonatomic, retain)NSMutableArray *informationArr;
@property(nonatomic, retain)NSMutableArray *evaliuationArr;
@property(nonatomic, retain)NSMutableArray *commentCountArr;
@property(nonatomic, retain)UITableView *tableView;
@property(nonatomic, retain)MBProgressHUD *hud;

@property(nonatomic, retain)UIView *allInformationView;
@property(nonatomic, retain)UIScrollView *scrollView;
@property(nonatomic, retain)UILabel *aboutLabel;
@property(nonatomic, retain)UILabel *placeLabel;
@property(nonatomic, retain)UILabel *bornLabel;
@property(nonatomic, retain)UILabel *experienceLabel;
@property(nonatomic, retain)UILabel *firstWayLabel;
@property(nonatomic, retain)UILabel *secondWayLabel;
@property(nonatomic, retain)UILabel *thirdWayLabel;
@property(nonatomic, retain)UILabel *introduceContentLabel;

@end

@implementation MZY_EX_foremanViewController

- (void)dealloc
{
    [self.allInformationView release];
    [self.scrollView release];
    [self.aboutLabel release];
    [self.placeLabel release];
    [self.bornLabel release];
    [self.experienceLabel release];
    [self.firstWayLabel release];
    [self.secondWayLabel release];
    [self.thirdWayLabel release];
    [self.introduceContentLabel release];
    [self.headView release];
    [self.faceImageView release];
    [self.nameLabel release];
    [self.jobLabel release];
    [self.workCountLabel release];
    [self.workLabel release];
    [self.textField release];
    [self.appointmentCountLabel release];
    [self.appointmentLabel release];
    [self.introduceArr release];
    [self.informationArr release];
    [self.evaliuationArr release];
    [self.commentCountArr release];
    [self.tableView release];
    [self.hud release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self createData];
    [self createView];
}

#pragma mark 获取数据
- (void)createData{
    NSString *urlStr = [NSString stringWithFormat:@"http://api.meilijia.com/app/user_home_page?user_id=%@",self.idStr];
    [NetworkingTool networkingWithStrURL:urlStr type:GETType bodyStr:nil block:^(id result) {
        self.introduceArr = [NSMutableArray array];
        NSDictionary *temp = result[@"data"][@"user_home_info"][@"user_info"];
        MZY_designerMaterial *material = [[MZY_designerMaterial alloc]init];
        [material setValuesForKeysWithDictionary:temp];
        [self.introduceArr addObject:material];
        [self.faceImageView sd_setImageWithURL:[NSURL URLWithString:material.face]];
        self.faceImageView.layer.cornerRadius = 40 * HORIZONTAL;
        self.faceImageView.layer.masksToBounds = YES;
        self.nameLabel.text = material.nick;
        self.nameLabel.textColor = [UIColor lightGrayColor];
        self.nameLabel.font = [UIFont systemFontOfSize:15 * HORIZONTAL];
        self.nameLabel.textAlignment = NSTextAlignmentCenter;
        self.jobLabel.text = @"工长";
        self.jobLabel.font = [UIFont systemFontOfSize:13 * HORIZONTAL];
        self.jobLabel.textColor = [UIColor whiteColor];
        self.jobLabel.alpha = 0.8;
        self.workCountLabel.text = material.verified_work_count;
        self.workCountLabel.textColor = [UIColor orangeColor];
        self.workCountLabel.font = [UIFont systemFontOfSize:20];
        self.workLabel.text = @"个施工项目";
        self.workLabel.font = [UIFont systemFontOfSize:13];
        self.workLabel.textColor = [UIColor lightGrayColor];
        self.appointmentCountLabel.text = material.contacted_count;
        self.appointmentCountLabel.textColor = [UIColor orangeColor];
        self.appointmentCountLabel.font = [UIFont systemFontOfSize:20];
        self.appointmentLabel.text = @"人预约过";
        self.appointmentLabel.font = [UIFont systemFontOfSize:13];
        self.appointmentLabel.textColor = [UIColor lightGrayColor];
        
        self.aboutLabel.text = [NSString stringWithFormat:@"%@%@",@"关于",material.nick];
        self.aboutLabel.textColor = [UIColor whiteColor];
        [material release];
        
        self.informationArr = [NSMutableArray array];
        NSDictionary *infDic = result[@"data"][@"user_home_info"][@"pro_service"];
        MZY_designerMaterial *infMaterial = [[MZY_designerMaterial alloc]init];
        [infMaterial setValuesForKeysWithDictionary:infDic];
        [self.informationArr addObject:infMaterial];
        self.placeLabel.text = infMaterial.location;
        self.placeLabel.textColor = [UIColor whiteColor];
        self.bornLabel.text = infMaterial.native_place;
        self.bornLabel.textColor = [UIColor whiteColor];
        self.experienceLabel.text = [NSString stringWithFormat:@"%@%@",infMaterial.exp_years,@"年"];
        self.experienceLabel.textColor = [UIColor whiteColor];
        if (infMaterial.services.count == 3) {
            self.firstWayLabel.text = infMaterial.services[0];
            self.firstWayLabel.textColor = [UIColor whiteColor];
            self.secondWayLabel.text = infMaterial.services[1];
            self.secondWayLabel.textColor = [UIColor whiteColor];
            self.thirdWayLabel.text = infMaterial.services[2];
            self.thirdWayLabel.textColor = [UIColor whiteColor];
        }else if (infMaterial.services.count == 2){
            self.firstWayLabel.text = infMaterial.services[0];
            self.firstWayLabel.textColor = [UIColor whiteColor];
            self.secondWayLabel.text = infMaterial.services[1];
            self.secondWayLabel.textColor = [UIColor whiteColor];
        }else{
            self.firstWayLabel.text = infMaterial.services[0];
            self.firstWayLabel.textColor = [UIColor whiteColor];
        }
        self.introduceContentLabel.text = infMaterial.bio;
        self.introduceContentLabel.textColor = [UIColor whiteColor];
        self.introduceContentLabel.numberOfLines = 0;
        [self.introduceContentLabel sizeToFit];
        self.scrollView.contentSize = CGSizeMake(WIDTH, self.introduceContentLabel.frame.size.height + 232);
        [infMaterial release];
        
        self.commentCountArr = [NSMutableArray array];
        NSDictionary *totalDic = result[@"data"][@"user_home_review_list"];
        MZY_designerMaterial *total = [[MZY_designerMaterial alloc]init];
        [total setValuesForKeysWithDictionary:totalDic];
        [self.commentCountArr addObject:total];
        [total release];
        
        self.evaliuationArr = [NSMutableArray array];
        for (NSDictionary *evaDic in result[@"data"][@"user_home_review_list"][@"reviews"]){
            MZY_designerMaterial *eva = [[MZY_designerMaterial alloc]init];
            [eva setValuesForKeysWithDictionary:evaDic];
            [self.evaliuationArr addObject:eva];
            [eva release];
        }
        self.hud.hidden = YES;
        [self.tableView reloadData];
    }];
}

#pragma mark 创建界面
- (void)createView{
    self.view.backgroundColor = [UIColor whiteColor];
    
    // 返回按钮
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    backButton.frame = CGRectMake(0, 0, 20, 20);
    [backButton setImage:[UIImage imageNamed:@"iconfont-arrowleft.png"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    
    // 分享按钮
    UIButton *shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
    shareButton.frame = CGRectMake(0, 0, 40, 40);
    [shareButton setImage:[UIImage imageNamed:@"iconfont-fenxiang.png"] forState:UIControlStateNormal];
    [shareButton addTarget:self action:@selector(shareAction:) forControlEvents:UIControlEventValueChanged];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:shareButton];
    
    // 创建头视图
    self.headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 220 * VERTICAL)];
    self.headView.backgroundColor = [UIColor whiteColor];
    [self.headView release];
    self.faceImageView = [[UIImageView alloc] initWithFrame:CGRectMake(180 * HORIZONTAL, 20 * VERTICAL, 80 * HORIZONTAL, 80 * HORIZONTAL)];
    [self.headView addSubview:self.faceImageView];
    [self.faceImageView release];
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(200 * HORIZONTAL, 105 * HORIZONTAL, 50 * HORIZONTAL, 25 * VERTICAL)];
    [self.headView addSubview:self.nameLabel];
    [self.nameLabel release];
    self.jobLabel = [[UILabel alloc] initWithFrame:CGRectMake(250 * HORIZONTAL, 108 * HORIZONTAL, 30 * HORIZONTAL, 20 * VERTICAL)];
    self.jobLabel.backgroundColor = [UIColor blueColor];
    [self.headView addSubview:self.jobLabel];
    [self.jobLabel release];
    self.workCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(180 * HORIZONTAL, 150 * VERTICAL, 30 * HORIZONTAL, 20 * VERTICAL)];
    [self.headView addSubview:self.workCountLabel];
    [self.workCountLabel release];
    self.workLabel = [[UILabel alloc] initWithFrame:CGRectMake(145 * VERTICAL, 175 * VERTICAL, 100 * HORIZONTAL, 20 * VERTICAL)];
    [self.headView addSubview:self.workLabel];
    [self.workLabel release];
    self.textField = [[UITextField alloc] initWithFrame:CGRectMake(220 * HORIZONTAL, 150 * VERTICAL, 1, 50 * VERTICAL)];
    self.textField.backgroundColor = [UIColor lightGrayColor];
    [self.headView addSubview:self.textField];
    [self.textField release];
    self.appointmentCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(240 * HORIZONTAL, 150 * VERTICAL, 50 * HORIZONTAL, 20 * VERTICAL)];
    [self.headView addSubview:self.appointmentCountLabel];
    [self.appointmentCountLabel release];
    self.appointmentLabel = [[UILabel alloc] initWithFrame:CGRectMake(230 * HORIZONTAL, 175 * VERTICAL, 100 * HORIZONTAL, 20 * VERTICAL)];
    [self.headView addSubview:self.appointmentLabel];
    [self.appointmentLabel release];
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT - 64) style:UITableViewStyleGrouped];
    self.tableView.backgroundColor = [UIColor whiteColor];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView registerClass:[MZY_EX_informationCell class] forCellReuseIdentifier:@"information"];
    [self.tableView registerClass:[MZY_EX_evaliuationCell class] forCellReuseIdentifier:@"evaliuation"];
    [self.view addSubview:self.tableView];
    self.tableView.tableHeaderView = self.headView;
    [self.tableView release];
    
    // 加载动画
    self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    
    // 创建介绍"view"
    self.allInformationView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    self.allInformationView.backgroundColor = [UIColor blackColor];
    self.allInformationView.alpha = 0.8;
    [self.allInformationView release];
    
    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    self.scrollView.backgroundColor = [UIColor clearColor];
    [self.allInformationView addSubview:self.scrollView];
    [self.scrollView release];
    
    UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    closeButton.frame = CGRectMake(200, HEIGHT - 50, 40, 40);
    [closeButton setImage:[UIImage imageNamed:@"iconfont-cha.png"] forState:UIControlStateNormal];
    [closeButton addTarget:self action:@selector(closeAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.allInformationView addSubview:closeButton];
    
    self.aboutLabel = [[UILabel alloc] initWithFrame:CGRectMake(160, 30, 100, 20)];
    [self.scrollView addSubview:self.aboutLabel];
    [self.aboutLabel release];
    
    UITextField *firstRow = [[UITextField alloc] initWithFrame:CGRectMake(10, 60, WIDTH - 20, 1)];
    firstRow.backgroundColor = [UIColor whiteColor];
    [self.scrollView addSubview:firstRow];
    [firstRow release];
    
    UILabel *serveLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 71, 70, 20)];
    serveLabel.text = @"服务地区";
    serveLabel.textColor = [UIColor whiteColor];
    [self.scrollView addSubview:serveLabel];
    [serveLabel release];
    
    self.placeLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 71, 200, 20)];
    [self.scrollView addSubview:self.placeLabel];
    [self.placeLabel release];
    
    UILabel *bornPlaceLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 101, 70, 20)];
    bornPlaceLabel.text = @"籍贯";
    bornPlaceLabel.textColor = [UIColor whiteColor];
    [self.scrollView addSubview:bornPlaceLabel];
    [bornPlaceLabel release];
    
    self.bornLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 101, 200, 20)];
    [self.scrollView addSubview:self.bornLabel];
    [self.bornLabel release];
    
    UILabel *constructionLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 131, 70, 20)];
    constructionLabel.text = @"施工经验";
    constructionLabel.textColor = [UIColor whiteColor];
    [self.scrollView addSubview:constructionLabel];
    [constructionLabel release];
    
    self.experienceLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 131, 200, 20)];
    [self.scrollView addSubview:self.experienceLabel];
    [self.experienceLabel release];
    
    UILabel *workLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 161, 70, 20)];
    workLabel.text  = @"施工方式";
    workLabel.textColor = [UIColor whiteColor];
    [self.scrollView addSubview:workLabel];
    [workLabel release];
    
    self.firstWayLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 161, 40, 20)];
    [self.scrollView addSubview:self.firstWayLabel];
    [self.firstWayLabel release];
    
    self.secondWayLabel = [[UILabel alloc] initWithFrame:CGRectMake(170, 161, 40, 20)];
    [self.scrollView addSubview:self.secondWayLabel];
    [self.secondWayLabel release];
    
    self.thirdWayLabel = [[UILabel alloc] initWithFrame:CGRectMake(250, 161, 40, 20)];
    [self.scrollView addSubview:self.thirdWayLabel];
    [self.thirdWayLabel release];
    
    UILabel *introduceLabel = [[UILabel alloc] initWithFrame:CGRectMake(170, 191, 100, 20)];
    introduceLabel.text = @"个人介绍";
    introduceLabel.textColor = [UIColor orangeColor];
    [self.scrollView addSubview:introduceLabel];
    [introduceLabel release];
    
    UITextField *secondRow = [[UITextField alloc] initWithFrame:CGRectMake(10, 221, WIDTH - 20, 1)];
    secondRow.backgroundColor = [UIColor whiteColor];
    [self.scrollView addSubview:secondRow];
    [secondRow release];
    
    self.introduceContentLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 232, WIDTH - 20, 420)];
    [self.scrollView addSubview:self.introduceContentLabel];
    [self.introduceContentLabel release];
}

#pragma mark "tableView"的第一个必须执行的方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 1;
    }else{           
        return self.evaliuationArr.count;
    }
}

#pragma mark 设置"tableView"里有多少个分区
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}

#pragma mark 返回行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        return 220 * HORIZONTAL;
    }else{
        return 340 * HORIZONTAL;
    }
}

#pragma mark 设置"cell"之间"headerView"的高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 15;
}

#pragma mark 设置"headerView"颜色
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *headerView = [[UIView alloc]init];
    headerView.backgroundColor = [UIColor lightGrayColor];
    headerView.alpha = 0.5;
    return headerView;
}

#pragma mark "tableView"的第一个必须执行的方法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        MZY_EX_informationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"information" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellEditingStyleNone;
        MZY_designerMaterial *designer = self.informationArr[indexPath.row];
        cell.locationLabel.text = @"服务地区";
        cell.locationLabel.textColor = [UIColor lightGrayColor];
        cell.locationLabel.textAlignment = NSTextAlignmentCenter;
        cell.locationDetailLabel.text = designer.location;
        cell.locationDetailLabel.textColor = [UIColor lightGrayColor];
        cell.nativeLabel.text = @"籍贯";
        cell.nativeLabel.textColor = [UIColor lightGrayColor];
        cell.nativeLabel.textAlignment = NSTextAlignmentCenter;
        cell.nativeDetailLabel.text = designer.native_place;
        cell.nativeDetailLabel.textColor = [UIColor lightGrayColor];
        cell.experienceLabel.text = @"施工经验";
        cell.experienceLabel.textColor = [UIColor lightGrayColor];
        cell.experienceLabel.textAlignment = NSTextAlignmentCenter;
        cell.experienceDetailLabel.text = [NSString stringWithFormat:@"%@%@",designer.exp_years,@"年"];
        cell.experienceDetailLabel.textColor = [UIColor lightGrayColor];
        cell.wayLabel.text = @"施工方式";
        cell.wayLabel.textColor = [UIColor lightGrayColor];
        cell.wayLabel.textAlignment = NSTextAlignmentCenter;
        if (designer.services.count == 1) {
            cell.wayFirstDetailLabel.text = designer.services[0];
            cell.wayFirstDetailLabel.textColor = [UIColor lightGrayColor];
        }else if (designer.services.count == 2){
            cell.wayFirstDetailLabel.text = designer.services[0];
            cell.wayFirstDetailLabel.textColor = [UIColor lightGrayColor];
            cell.waySecondDetailLabel.text = designer.services[1];
            cell.waySecondDetailLabel.textColor = [UIColor lightGrayColor];
        }else{
            cell.wayFirstDetailLabel.text = designer.services[0];
            cell.wayFirstDetailLabel.textColor = [UIColor lightGrayColor];
            cell.waySecondDetailLabel.text = designer.services[1];
            cell.waySecondDetailLabel.textColor = [UIColor lightGrayColor];
            cell.wayThirdDetailLabel.text = designer.services[2];
            cell.wayThirdDetailLabel.textColor = [UIColor lightGrayColor];
        }
        [cell.allInformationButton setTitle:@"查看全部信息" forState:UIControlStateNormal];
        [cell.allInformationButton setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
        cell.allInformationButton.layer.borderWidth = 1;
        [cell.allInformationButton addTarget:self action:@selector(allInformationAction:) forControlEvents:UIControlEventTouchUpInside];
        return cell;
    }else{
        MZY_EX_evaliuationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"evaliuation" forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellEditingStyleNone;
        MZY_designerMaterial *commentCount = [self.commentCountArr lastObject];
        cell.commentCountLabel.text = [NSString stringWithFormat:@"%@%@",commentCount.total,@"条评价"];
        cell.commentCountLabel.textAlignment = NSTextAlignmentCenter;
        MZY_designerMaterial *all = self.evaliuationArr[indexPath.row];
        [cell.faceImageView sd_setImageWithURL:[NSURL URLWithString:all.user_face]];
        cell.faceImageView.layer.cornerRadius = 15;
        cell.faceImageView.layer.masksToBounds = YES;
        cell.nameLabel.text = all.user_nick;
        cell.attitudeLabel.text = @"服务态度";
        cell.attitudeLabel.textColor = [UIColor lightGrayColor];
        cell.attitudeDetailLabel.text = [NSString stringWithFormat:@"%@%@",all.rating1,@"星"];
        NSMutableAttributedString *attitudeStr = [[NSMutableAttributedString alloc] initWithString:cell.attitudeDetailLabel.text];
        [attitudeStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 1)];
        [attitudeStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20] range:NSMakeRange(0, 1)];
        [cell.attitudeDetailLabel setAttributedText:attitudeStr];
        [attitudeStr release];
        cell.timeLabel.text = @"按时完成";
        cell.timeLabel.textColor = [UIColor lightGrayColor];
        cell.timeDetailLabel.text = [NSString stringWithFormat:@"%@%@",all.rating3,@"星"];
        NSMutableAttributedString *timeStr = [[NSMutableAttributedString alloc] initWithString:cell.timeDetailLabel.text];
        [timeStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 1)];
        [timeStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20] range:NSMakeRange(0, 1)];
        [cell.timeDetailLabel setAttributedText:timeStr];
        [timeStr release];
        cell.qualityLabel.text = @"施工质量";
        cell.qualityLabel.textColor = [UIColor lightGrayColor];
        cell.qualityDetailLabel.text = [NSString stringWithFormat:@"%@%@",all.rating2,@"星"];
        NSMutableAttributedString *qualityStr = [[NSMutableAttributedString alloc] initWithString:cell.qualityDetailLabel.text];
        [qualityStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 1)];
        [qualityStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20] range:NSMakeRange(0, 1)];
        [cell.qualityDetailLabel setAttributedText:qualityStr];
        [qualityStr release];
        cell.priceLabel.text = @"报价相符";
        cell.priceLabel.textColor = [UIColor lightGrayColor];
        cell.priceDetailLabel.text = [NSString stringWithFormat:@"%@%@",all.rating4,@"星"];
        NSMutableAttributedString *priceStr = [[NSMutableAttributedString alloc] initWithString:cell.priceDetailLabel.text];
        [priceStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 1)];
        [priceStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20] range:NSMakeRange(0, 1)];
        [cell.priceDetailLabel setAttributedText:priceStr];
        [priceStr release];
        cell.commentLabel.text = all.content;
        cell.commentLabel.font = [UIFont systemFontOfSize:15];
        cell.commentLabel.numberOfLines = 0;
        [cell.commentLabel sizeToFit];
        cell.placeLabel.text = all.col_info;
        cell.placeLabel.textColor = [UIColor whiteColor];
        cell.rightImageView.image = [UIImage imageNamed:@"iconfont-dui.png"];
        cell.realLabel.text = @"该评价真实性已验证";
        cell.realLabel.textColor = [UIColor greenColor];
        return cell;
    }
}

#pragma mark 返回按钮的点击方法
- (void)backAction:(UIButton *)button{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

#pragma mark 分享按钮的点击方法
- (void)shareAction:(UIButton *)button{
    
}

#pragma mark 查看全部信息按钮的点击方法
- (void)allInformationAction:(UIButton *)button{
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    [self.view addSubview:self.allInformationView];
}

#pragma mark 关闭按钮的点击方法
- (void)closeAction:(UIButton *)button{
    [self.allInformationView removeFromSuperview];
    [self.navigationController setNavigationBarHidden:NO animated:NO];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
